<template>
    <div>
        <h1>用户列表</h1>
        <ul>
            <li v-for="item in Users" :key="item.id">{{ item.name }},{{ item.age }}</li>
        </ul>
    </div>
</template>

<script setup>
import {onMounted,ref} from 'vue'
import axios from 'axios'
const Users=ref({

})
onMounted(async()=> {
    try {
        const response = await axios.get('/api/user')
        console.log(response);
        Users.value=response.data.data
    } catch (error) {
        console.error('获取数据失败',error);
    }
})


</script>